<?php
/**
 * Created by PhpStorm.
 * User: zhan
 * Date: 2018/6/11  17:57
 */
namespace app\admin\controller;
class Member extends Common
{


    //会员表
    private $table_admin = "";

    /*
    *	构造函数
    */
    function __construct()
    {
        parent::__construct();
        $this->admin = db("admin");
    }

    //会员列表
    public function li()
    {
        $mobile = input('mobile');
        $pageParam = ['query' =>[]];
        $where = '';

        if($mobile){
            $where['mobile'] = array('like','%'.$mobile.'%');
        }

        $pageParam['query']['mobile'] = $mobile;

        $members = db('member')->where($where)->order('id desc')->paginate(15,false,$pageParam);
        $this->assign('data', $members);
        $this->assign('mobile',$mobile);
        return $this->fetch();
    }

    //抽奖纪录
    public function lottery_record()
    {
        $title = input('title');
        $id = input('id');
        $pageParam = ['query' =>[]];
        
        $where['uid'] = $id;
        if($title){
            $where['ay.title'] = array('like','%'.$title.'%');
        }

        $list = db('lottery_record')->alias('lr')
            ->where($where)
            ->join('activity ay','ay.id=lr.aid')
            ->field('ay.title,lr.*')
            ->order('lr.id desc')
            ->paginate(15,false,$pageParam);
        $this->assign('list',$list);
        return $this->fetch();
    }

}
